const mysql = require('mysql');

const pool = mysql.createPool({
    host: 'localhost',
    user: 'root',
    password: '',
    database: 'database'
})

function execute(sqlString,condition) {
    let res = new Promise((resolve,reject) => {
        pool.query(sqlString,condition,function(error,result,fields) {
            if(error) {
                reject(error)
            }else{
                resolve(result)
            }
        })
    })

    return res
}

module.exports = {
    EXECUTE: execute
}